package com.roadjava.demo09.bean;

import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;

public class UserInfo9 {


    // 标记接口，新增组
    public interface AddGroup {
    }

    // 标记接口，修改组
    public interface UpdateGroup {
    }

    // 默认的组 javax.validation.groups.Default

    @Null(groups = {AddGroup.class}) // 只适用于新增
    @NotNull(groups = {UpdateGroup.class}) // 只适用于修改
    private Long id;

    @NotBlank
    private String name;

    @NotNull
    @Range(min = 1, max = 800)
    private Integer age;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }


    public void setAge(Integer age) {

        this.age = age;
    }
}